#ifndef __CLOUDISK_SERVER_H_
#define __CLOUDISK_SERVER_H_

#include "Sigup.h"
#include "Sigin.h"
#include "UserInfo.h"
#include "FileUpLoad.h"
#include "FileList.h"
#include "FileDownLoad.h"
#include <wfrest/HttpServer.h>
#include <workflow/WFFacilities.h>


// 装饰者模式 (套壳) Wrapper
class CloudiskServer
{
public:
    CloudiskServer();
    int start(unsigned port) { return m_server.start(port); }

    CloudiskServer& track() { m_server.track(); return *this; }
    
    void list_routes() { m_server.list_routes(); };

    void stop() { m_server.stop(); };

    void register_modules();

private:
    void register_static_resources_module();
    void register_signup_module();
    void register_signin_module();
    void register_userinfo_module();
    void register_fileupload_module();
    void register_filelist_module();
    void register_filedownload_module();
private:
    wfrest::HttpServer m_server;
    Sigup m_sigup;
    Sigin m_sigin;
    UserInfo m_userInfo;
    FileUpLoad m_fileUpLoad;
    FileList m_fileList;
    FileDownLoad m_fileDownload;
};

#endif